package schoolDemo3;
import java.util.*;
class CyLinder{
    private double radius;
    private double pi=3.14;
    private double height;
    //求圆柱的底面积
    double area(){return pi*radius*radius;}
    //求圆柱的体积
    double volume(){return this.area()*height;}
    public CyLinder(){};
    //利用有参数的构造方法得到圆柱必需的参数，求出底面积和体积
    public CyLinder(double r,double h){
        radius=r;
        height=h;
        System.out.print("此圆柱的底面积为："+(int)area());
        System.out.print("\n此圆柱的体积为："+(int)volume());

    }
}
public class App6_1 {
    public static void main(String[] args){
        //建立Scanner对象，从键盘读入数据；并利用数组存储起来
        double[] arr=new double[2];
        Scanner reader=new Scanner(System.in);
        System.out.println("请输入圆柱的半径：");
        arr[0]=reader.nextDouble();
        System.out.println("请输入圆柱的高：");
        arr[1]=reader.nextDouble();
        CyLinder new_CyLinder=new CyLinder(arr[0],arr[1]);
    }
}
